package com.netrust.cmsx.admin.modules.sys.security;

import java.io.Serializable;

import com.netrust.cmsx.admin.modules.sys.utils.UserUtils;
import com.netrust.cmsx.entity.module.sys.User;

public class Principal implements  Serializable{

	private static final long serialVersionUID = 6387522410649732183L;
	private String id; // 编号
	private String loginName; // 登录名
	private String name; // 姓名
	
	public Principal(User user) {
		this.id = user.getId();
		this.loginName = user.getLoginName();
		this.name = user.getName();
	}

	public String getId() {
		return id;
	}

	public String getLoginName() {
		return loginName;
	}

	public String getName() {
		return name;
	}
	
	/**
	 * 获取SESSIONID
	 */
	public String getSessionid() {
		try{
			return (String) UserUtils.getSession().getId();
		}catch (Exception e) {
			return "";
		}
	}
	
	@Override
	public String toString() {
		return id;
	}
}
